﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DomainModel
{
    public class TagNode
    {
        public TagNode(Tag tag = null)
        {
            Tag = tag;
            Childs = new List<TagNode>();
        }

        public void build(ISmartNoteModel model)
        {
            int id = (Tag != null) ? Tag.Id : 0;
            IList<Tag> tags = model.getChildrenTags(id);
            foreach (Tag tag in tags)
            {
                TagNode node = new TagNode(tag);
                node.build(model);
                Childs.Add(node);
            }
        }

        public Tag Tag { get; private set; }
        public IList<TagNode> Childs { get; private set; }
    };
}
